﻿using DataInit.DataContexts;
using DataInit.DataContexts.DataGenerate;
using DataInit.DataContexts.DataSave;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Text;

namespace DataInit
{
    public static class Startup
    {
        static string connstring = "Server=192.168.50.131;Database=performancetest;uid=sa;pwd=adminadmin;";
        public static IServiceCollection AddSagaStorage(this IServiceCollection services)
        {

            return services.AddDbContext<PTDBContext>(option => option.UseSqlServer(connstring), ServiceLifetime.Singleton);

        }

        public static IServiceCollection AddDataSaver(this IServiceCollection services)
        {

            return services.AddSingleton<DataSaver>()
                .AddSingleton<DataGenerator>();

        }

    }
}
